#include "lib.h"

#include "patch.h"
#include "admlogin.h"
#include "admpipe.h"
#include "log.h"

#define SELF	AdminLogin
#define SUPER	AdminProtocol

void
AdminLogin::handle(uint8* Msg, int32 Len)
{
	if (!pipe->isLoggedOn())
	{
		int32 err = 0;

#if 0
		if (isServerStopping())
		{
			sendStopMsg();
			return;
		}
#endif

		if (!parseLogin(&err))
		{
			Log::msgError("AdminLogin: Login failed");

			pipe->sendError(err);
			return;
		}

		pipe->setLoggedOn();
		pipe->msgStart();
		pipe->msgAdd((uint8)'S');
		pipe->msgEnd();
	}
	else
	{
		Log::msgWarning("AdminPipe: Attempt to re-login");

		pipe->sendError(APE_ATTEMPT_RELOGIN);
	}
}

bool8
AdminLogin::parseLogin(int32* /*Err*/)
{
	return true;
}

